package com.xiaoshou.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "lectures_departments_rel", catalog = "market")
public class LecturesDepartmentsRel implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

	private LecturesDepartmentsRelId id;
	private Departments departments;
	private Lectures lectures;

	// Constructors

	/** default constructor */
	public LecturesDepartmentsRel() {
	}

	/** full constructor */
	public LecturesDepartmentsRel(LecturesDepartmentsRelId id,
			Departments departments, Lectures lectures) {
		this.id = id;
		this.departments = departments;
		this.lectures = lectures;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "lecturesid", column = @Column(name = "lecturesid", nullable = false, length = 40)),
			@AttributeOverride(name = "departmentsid", column = @Column(name = "departmentsid", nullable = false, length = 40)) })
	public LecturesDepartmentsRelId getId() {
		return this.id;
	}

	public void setId(LecturesDepartmentsRelId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "departmentsid", nullable = false, insertable = false, updatable = false)
	public Departments getDepartments() {
		return this.departments;
	}

	public void setDepartments(Departments departments) {
		this.departments = departments;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "lecturesid", nullable = false, insertable = false, updatable = false)
	public Lectures getLectures() {
		return this.lectures;
	}

	public void setLectures(Lectures lectures) {
		this.lectures = lectures;
	}

}